/**
 * 
 */
package com.ilock.service;

import java.sql.Timestamp;
import java.util.List;

import com.ilock.bean.Ilocklog;
import com.ilock.bean.IlocklogDAO;

/**
 * @author Administrator
 *
 */
public class LockLogServiceImpl implements ILockLogService {

	private IlocklogDAO IlocklogDAO;
	
	public IlocklogDAO getIlocklogDAO() {
		return IlocklogDAO;
	}

	public void setIlocklogDAO(IlocklogDAO ilocklogDAO) {
		IlocklogDAO = ilocklogDAO;
	}

	/* (non-Javadoc)
	 * @see com.ilock.service.ILockLogService#addLockLog(com.ilock.bean.Ilocklog)
	 */
	@Override
	public boolean addLockLog(Ilocklog ilocklog) {
		// TODO Auto-generated method stub
		IlocklogDAO.save(ilocklog);
		return true;
	}

	/* (non-Javadoc)
	 * @see com.ilock.service.ILockLogService#updateLockLog(com.ilock.bean.Ilocklog)
	 */
	@Override
	public boolean updateLockLog(Ilocklog ilocklog) {
		// TODO Auto-generated method stub
		IlocklogDAO.merge(ilocklog);
		return true;
	}

	/* (non-Javadoc)
	 * @see com.ilock.service.ILockLogService#deleteLockLog(com.ilock.bean.Ilocklog)
	 */
	@Override
	public boolean deleteLockLog(Ilocklog ilocklog) {
		// TODO Auto-generated method stub
		return false;
	}

	/* (non-Javadoc)
	 * @see com.ilock.service.ILockLogService#getLockLogListByUserId(int)
	 */
	@Override
	public List<Ilocklog> getLockLogListByUserId(int userID,Timestamp date) {
		// TODO Auto-generated method stub
		return IlocklogDAO.findLatestLogByUserId(userID, date);
	}

	/* (non-Javadoc)
	 * @see com.ilock.service.ILockLogService#getLockLogListByLockId(int)
	 */
	@Override
	public List<Ilocklog> getLockLogListByLockId(int lockID,Timestamp date) {
		// TODO Auto-generated method stub
		return IlocklogDAO.findLatestLogByLockId(lockID, date);
	}

}
